<!DOCTYPE html>
<html lang="en">
  <head>
    <meta charset="UTF-8" />
    <title>后盾人</title>
  </head>
  <body></body>
  <script>
    function extend(sub, sup) {
      sub.prototype = Object.create(sup.prototype);
      Object.defineProperty(sub.prototype, "constructor", {
        value: sub,
        enumerable: false
      });
    }
    function User(name, age) {
      this.name = name;
      this.age = age;
    }
    User.prototype.show = function() {
      console.log(this.name, this.age);
    };
    function Admin(...args) {
      User.apply(this, args);
    }
    extend(Admin, User);
    let admin = new Admin("向军", 19);
    admin.show();
    function Member(...args) {
      User.apply(this, args);
    }
    extend(Member, User);
    let member = new Member("李四", 23);
    member.show();
    // Member.prototype = Object.create(User.prototype);
    // Object.defineProperty(Member.prototype, "constructor", {
    //   value: Member,
    //   enumerable: false
    // });
  </script>
</html>
